# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=blosc2
pkgver=2.10.0
pkgrel=1
pkgdesc="A fast, compressed, persistent binary data store library for C."
arch=(loong64 x86_64)
url="https://www.blosc.org"
license=(BSD)
depends=(lz4 zlib zstd)
makedepends=(cmake)
source=(https://github.com/Blosc/c-blosc2/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('1d7588cc8e1ffbb4cee4549e0f913e0671e02b405c918eb0bebde7a6af35005c1e7c6c95142cd80abd7175542e9f91e8454fd88262f668c3a24982b69f1644fa')
b2sums=('c3469b38196efab099ee117b74e864de06ed9619e53b8a895ac761876bafff944d1315e1a51064b6b92198a22691018e0ce25ee4485d2e36b7017ec642224b6d')

build() {
  cmake -B build -S c-blosc2-$pkgver \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D PREFER_EXTERNAL_LZ4=ON \
    -D PREFER_EXTERNAL_ZLIB=ON \
    -D PREFER_EXTERNAL_ZSTD=ON
  cmake --build build
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -vDm644 c-blosc2-$pkgver/LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
}
